mod mimalloc;

use crate::mimalloc::MyAllocator;

#[global_allocator]
static GLOBAL: MyAllocator = MyAllocator;
fn main() {
    MyAllocator.mi_register_deferred_free(|_, _| {});
    let size = 1 << 15;
    let mut a = Vec::with_capacity(size);
    for i in 0..100 {
        a.push(i);
    }
    println!("{:?}", a);

    drop(a);

    // libc_println!("empty heap 0x{:x}", &_MI_HEAP_EMPTY as *const _ as usize);
    // libc_println!("Hello from a heap 0x{:x}", get_heap_default() as usize);
    // unsafe{libc_println!("Hello from a heap 0x{:x}", (*get_heap_default()).thread_id as usize);}
    // println!("Hello, world!");
    // let handle = thread::spawn(|| {
    //     let a = Box::new(5);
    //     println!("Hello, world!{}, {}", mi_thread_id(), a);
    //     libc_println!("Hello from a heap 0x{:x}", get_heap_default() as usize);
    //     unsafe{libc_println!("Hello from a heap 0x{:x}", (*get_heap_default()).thread_id as usize);}
    // });
    // handle.join().unwrap();
}
